package com.dailywork.basepro.compro;

import java.util.Arrays;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import java.util.stream.Collectors;

public class ComPro2 {
    public static void main(String[] args) {
        oper1();
    }

    private static void oper1() {
        String[] strs = new String[] { "abc", "bcd", "acef", "ze", "xyz", "az", "ba", "a", "z" };
        Map<Integer,Set<String>> map = Arrays.stream(strs).collect(Collectors.groupingBy(String::length,Collectors.toCollection(TreeSet::new)));
        map.values().stream().forEachOrdered(System.out::println);
    }
}